package cn.rulian.one.file.bo;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import org.springframework.format.annotation.DateTimeFormat;

import cn.rulian.base.common.bo.BaseBo;

import com.fasterxml.jackson.annotation.JsonFormat;

/**
 * 功能描述：共享文件（文件的上传、下载）
 */
@Entity
@Table(name = "one_file_sharedfile")
public class SharedFile extends BaseBo
{
	//文件类型
	public static final String TYPE_MY = "my"; //个人文件
	public static final String TYPE_SHARE = "share"; //共享文件
	
	@Column(length = 100)
	private String showName; //显示名称
	
	@Column(length = 100)
	private String fileName; //文件存储名称
	
	private Long fileSize; //文件大小
	
	@Column(length = 10)
	private String fileType; //文件类型：个人文件 my,共享文件 share

	@ManyToOne
	@JoinColumn(name = "fileSort_id")
	private FileSort fileSort; //文件分类

	@Column(length = 50)
	private String userName; //上传用户姓名
	
	private Long userId; //上传用户ID

	@DateTimeFormat(pattern="yyyy-MM-dd HH:mm") //Spring MVC格式转换：增加、修改时，向后台传送数据时用
	@JsonFormat(pattern="yyyy-MM-dd HH:mm",timezone = "GMT+8") //json格式化输出，列表显示时用
	private Date addTime; //创建时间

	
	public String getShowName()
	{
		return showName;
	}

	public void setShowName(String showName)
	{
		this.showName = showName;
	}

	public String getFileName()
	{
		return fileName;
	}

	public void setFileName(String fileName)
	{
		this.fileName = fileName;
	}

	public String getFileType()
	{
		return fileType;
	}

	public void setFileType(String fileType)
	{
		this.fileType = fileType;
	}

	public FileSort getFileSort()
	{
		return fileSort;
	}

	public void setFileSort(FileSort fileSort)
	{
		this.fileSort = fileSort;
	}

	public String getUserName()
	{
		return userName;
	}

	public void setUserName(String userName)
	{
		this.userName = userName;
	}

	public Long getUserId()
	{
		return userId;
	}

	public void setUserId(Long userId)
	{
		this.userId = userId;
	}

	public Date getAddTime()
	{
		return addTime;
	}

	public void setAddTime(Date addTime)
	{
		this.addTime = addTime;
	}

	public static String getTypeMy()
	{
		return TYPE_MY;
	}

	public static String getTypeShare()
	{
		return TYPE_SHARE;
	}

	public Long getFileSize()
	{
		return fileSize;
	}

	public void setFileSize(Long fileSize)
	{
		this.fileSize = fileSize;
	}
	
}
